<template>
  <view class="container">
    <view class="box">
      <view class="title">{{ obj.status == 1 ? '申请中' : obj.status == 1 ? '已开票' : '已驳回' }}</view>
      <view class="item">
        <view class="title1">时间</view>
        <view class="txt">{{ obj.time }}</view>
      </view>
      <view class="item">
        <view class="title1">开票金额</view>
        <view class="txt">{{ obj.money }}元</view>
      </view>
      <view class="item">
        <view class="title1">抬头</view>
        <view class="txt">{{ obj.title }}</view>
      </view>
      <view class="item">
        <view class="title1">税号</view>
        <view class="txt">{{ obj.taxid }}</view>
      </view>
      <view class="item">
        <view class="title1">接收邮箱</view>
        <view class="txt">{{ obj.mail }}@qq.com</view>
      </view>
      <view class="item">
        <view class="title1">申请时间</view>
        <view class="txt">{{ obj.time }}</view>
      </view>
      <view class="item">
        <view class="title1">开票时间</view>
        <view class="txt">{{ obj.Invoicingtime ? obj.kaitime : '' }}</view>
      </view>
    </view>
  </view>
</template>

<script>
import dayjs from 'dayjs';
export default {
  data() {
    return {
      status: 1,
      obj: {}
    };
  },
  onLoad(opt) {
    if (opt.id) {
      this.getdetail(opt.id);
    }
  },
  methods: {
    async getdetail(id) {
      const res = await this.http('/ticket/historyDetails', {
        ticket_id: id
      });
      console.log('开票详情', res);
      this.obj = res.data;
      this.obj.time = dayjs(this.obj.createtime * 1000).format('YYYY-MM-DD HH:mm');
      if (!this.obj.Invoicingtime) {
        this.obj.kaitime = dayjs(this.obj.Invoicingtime * 1000).format('YYYY-MM-DD HH:mm');
      }
    }
  }
};
</script>

<style lang="scss" scoped>
.container {
  box-sizing: border-box;
  .box {
    box-sizing: border-box;
    width: 702rpx;
    height: 596rpx;
    background: #ffffff;
    border-radius: 20rpx 20rpx 20rpx 20rpx;
    margin: 20rpx 24rpx;
    .title {
      font-weight: bold;
      font-size: 32rpx;
      color: #3483f6;
      margin: 45rpx 247rpx;
      text-align: center;
    }
    .item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 24rpx;
      .title1 {
        width: 130rpx;
        font-weight: 500;
        font-size: 28rpx;
        color: #222222;
      }
      .txt {
        font-weight: 500;
        font-size: 28rpx;
        color: #222222;
      }
    }
  }
}
</style>
